#include <stdio.h>

int main() {
    int n, x1;
    scanf("%d", &n);
    int a[n], b[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]); 
    }
    scanf("%d", &x1);
    for (int i = 0; i < n; i++) {
        printf("%5d", a[i]);
    }
    printf("\n");
    int j = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] != x1) {
            b[j] = a[i];
            j++;
        }
    }
    if (j > 0) {
        for (int i = 0; i < j; i++) {
            printf("%5d", b[i]);
        }
    } else {
        printf("empty");
    }
    return 0;
}